<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Replication Manager methods</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
    <link rel="up" href="rep.html" title="Chapter 12.  Berkeley DB Replication" />
    <link rel="prev" href="rep_app.html" title="Building replicated applications" />
    <link rel="next" href="rep_base_meth.html" title="Base API Methods" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Replication Manager methods</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="rep_app.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 12. 
		Berkeley DB Replication
        </th>
          <td width="20%" align="right"> <a accesskey="n" href="rep_base_meth.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="rep_mgr_meth"></a>Replication Manager methods</h2>
          </div>
        </div>
      </div>
      <p>Applications which use the Replication Manager support generally call
the following Berkeley DB methods.  The general pattern is to call various
methods to configure Replication Manager, and then start it by calling
<a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a>.  Once this initialization is complete, the
application rarely needs to call any of these methods.  (A prime
example of an exception to this rule would be the <a href="../api_reference/C/repsync.html" class="olink">DB_ENV-&gt;rep_sync()</a> method,
if the application is <a class="xref" href="rep_mastersync.html#rep_delay_sync" title="Delaying client synchronization">Delaying client synchronization</a>.)</p>
      <div class="variablelist">
        <dl>
          <dt>
            <span class="term">
              <a href="../api_reference/C/repmgrlocal_site.html" class="olink">DB_ENV-&gt;repmgr_set_local_site()</a>
            </span>
          </dt>
          <dd>
            <p>
            The <a href="../api_reference/C/repmgrlocal_site.html" class="olink">DB_ENV-&gt;repmgr_set_local_site()</a> method configures the TCP/IP address of
            the local site, by specifying the port number on which it is to
            listen for incoming connection requests.  This method must be
            called exactly once before calling <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a>.
        </p>
          </dd>
          <dt>
            <span class="term">
              <a href="../api_reference/C/repmgrremote_site.html" class="olink">DB_ENV-&gt;repmgr_add_remote_site()</a>
            </span>
          </dt>
          <dd>
            <p>
            The <a href="../api_reference/C/repmgrremote_site.html" class="olink">DB_ENV-&gt;repmgr_add_remote_site()</a> method adds a remote site to the list
            of sites initially known by the local site.  The remote site is
            specified in terms of a TCP/IP network address: host name and
            port number.  This method may be called as many times as
            necessary to configure all known remote sites.  Note that it is
            usually not necessary for each site in the replication group
            initially to know about all other sites in the group.  Sites
            can discover each other dynamically, as described in <a class="xref" href="rep_newsite.html" title="Connecting to a new site">Connecting to a new site</a>.
        </p>
          </dd>
          <dt>
            <span class="term">
              <a href="../api_reference/C/repmgrset_ack_policy.html" class="olink">DB_ENV-&gt;repmgr_set_ack_policy()</a>
            </span>
          </dt>
          <dd>
            <p>
            The <a href="../api_reference/C/repmgrset_ack_policy.html" class="olink">DB_ENV-&gt;repmgr_set_ack_policy()</a> method configures the acknowledgement
            policy to be used in the replication group, in other words, the
            behavior of the master with respect to acknowledgements for
            "permanent" messages, which implements the application's
            requirements for <a class="xref" href="rep_trans.html" title="Transactional guarantees">Transactional guarantees</a>.  The current implementation
            requires all sites in the replication group to configure the same
            acknowledgement policy.
        </p>
          </dd>
          <dt>
            <span class="term">
              <a href="../api_reference/C/repnsites.html" class="olink">DB_ENV-&gt;rep_set_nsites()</a>
            </span>
          </dt>
          <dd>
            <p>
            The <a href="../api_reference/C/repnsites.html" class="olink">DB_ENV-&gt;rep_set_nsites()</a> method tells Replication Manager the total
            number of sites in the replication group.  This is usually
            necessary for proper operation of elections, and for counting
            message acknowledgements (depending on the acknowledgement
            policy).
        </p>
          </dd>
          <dt>
            <span class="term">
              <a href="../api_reference/C/reppriority.html" class="olink">DB_ENV-&gt;rep_set_priority()</a>
            </span>
          </dt>
          <dd>
            <p>
            The <a href="../api_reference/C/reppriority.html" class="olink">DB_ENV-&gt;rep_set_priority()</a> method configures the local site's priority
            for the purpose of elections.
        </p>
          </dd>
          <dt>
            <span class="term">
              <a href="../api_reference/C/repset_timeout.html" class="olink">DB_ENV-&gt;rep_set_timeout()</a>
            </span>
          </dt>
          <dd>
            <p>
            This method optionally configures various timeout values.
            Otherwise default timeout values as specified in <a href="../api_reference/C/repset_timeout.html" class="olink">DB_ENV-&gt;rep_set_timeout()</a>
            are used.  In particular, Replication Manager client sites can
            be configured to monitor the health of the TCP/IP connection to
            the master site using heartbeat messages.  If the client
            receives no messages from the master for a certain amount of
            time, it considers the connection to be broken, and calls for
            an election to choose a new master.
        </p>
          </dd>
          <dt>
            <span class="term">
              <a href="../api_reference/C/envevent_notify.html" class="olink">DB_ENV-&gt;set_event_notify()</a>
            </span>
          </dt>
          <dd>
            <p>
            Once configured and started, Replication Manager does virtually
            all of its work in the background, usually without the need for
            any direct communication with the application.  However,
            occasionally events occur which the application may be
            interested in knowing about.  The application can request
            notification of these events by calling the <a href="../api_reference/C/envevent_notify.html" class="olink">DB_ENV-&gt;set_event_notify()</a>
            method.
        </p>
          </dd>
          <dt>
            <span class="term">
              <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a>
            </span>
          </dt>
          <dd>
            <p>
            The <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a> method starts the replication system.  It
            opens the listening TCP/IP socket and creates all the
            background processing threads that will be needed.
        </p>
          </dd>
        </dl>
      </div>
      <p>In addition to the methods previously described, Replication Manager
applications may also call the following methods, as needed:
<a href="../api_reference/C/repconfig.html" class="olink">DB_ENV-&gt;rep_set_config()</a>, <a href="../api_reference/C/repset_limit.html" class="olink">DB_ENV-&gt;rep_set_limit()</a>, <a href="../api_reference/C/repset_request.html" class="olink">DB_ENV-&gt;rep_set_request()</a>, 
<a href="../api_reference/C/repsync.html" class="olink">DB_ENV-&gt;rep_sync()</a> and <a href="../api_reference/C/repstat.html" class="olink">DB_ENV-&gt;rep_stat()</a>.</p>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="rep_app.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="rep.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="rep_base_meth.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Building replicated applications </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Base API Methods</td>
        </tr>
      </table>
    </div>
  </body>
</html>
